package com.u3k.mid;

import com.u3k.app.mid.core.ModuleManager;
import com.u3k.app.mid.utils.common.Util;
import com.u3k.app.mid.utils.net.DownloadCallback;
import com.u3k.app.mid.utils.statistics.StatisticsManager;
import java.io.File;

class e implements DownloadCallback {
    final /* synthetic */ ModuleInfo a;
    final /* synthetic */ d b;

    e(d dVar, ModuleInfo uVar) {
        this.b = dVar;
        this.a = uVar;
    }

    public void onDownloadBegin() {
    }

    public void onDownloaded() {
        LogUtils.LogError(d.a, "startDownload  onDownloaded");
        try {
            String a = this.b.a(this.b.f, this.a);
            long a2 = al.a(a);
            LogUtils.LogError(d.a, "startDownload  onDownloaded  module=" + this.a.name + ", path=" + a + ", downloadCrc32=" + a2);
            if (this.a.crc32 != a2) {
                LogUtils.LogError(d.a, "startDownload  onDownloaded libCrc32=" + this.a.crc32 + ", downloadCrc32=" + a2 + ", delete=" + new File(a).delete());
                return;
            }
            String a3 = v.a(this.b.f, this.a.name, this.a.libVersion);
            File file = new File(a3);
            if (!file.exists()) {
                file.mkdirs();
            }
            Util.copyFile(a, a3 + "lib.odex");
            ModuleManager.getInstance(this.b.f).updateModule(this.b.f, this.a);
            this.b.b();
            LogUtils.LogError(d.a, "startDownload  onDownloaded  end");
        } catch (Exception e) {
            LogUtils.LogError(d.a, "startDownload  onDownloaded  Exception=" + e.getMessage());
            StatisticsManager.getInstance().logException(ae.a(), e);
        } finally {
            this.b.b();
        }
    }

    public void onFailure(int i, String str) {
        LogUtils.LogError(d.a, "startDownload  onFailure code=" + i + ", errMsg=" + str);
        this.b.b();
    }

    public void onProgress(float f) {
    }
}
